package com.example.javabasic.shejimoshi.daili.demo1;
//代理
public class Proxy implements Subject{
    //持有真实主题的引用
    private RealSubject realSubject;


    public Proxy(){
        realSubject = new RealSubject();
    }
    @Override
    public void request() {
        before();
        realSubject.request();
        after();
    }

    //前通知方法
    public void before(){
        System.out.println("访问代理类  前置通知");
    }
    //后通知方法
    public void after(){
        System.out.println("访问代理类  后置通知");
    }

}
